package com.longge;

import java.util.ArrayList;
import java.util.List;
import java.util.TreeSet;

/**
 * @创建人 xinglongge
 * @创建时间 2021/11/17
 * @描述
 */
public class SequentialDigits {

    public List<Integer> sequentialDigits(int low, int high) {
        TreeSet<Integer> ans = new TreeSet<>();
        for (int i = 1; i <= 9; ++i) {
            int num = i;
            for (int j = i + 1; j <= 9; ++j) {
                num = num * 10 + j;
                if (num >= low && num <= high) {
                    ans.add(num);
                }
            }
        }
        return new ArrayList<>(ans);

    }
}
